package study.domain.blog;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;

import lombok.Data;
import study.domain.user.User;

@Embeddable
@Data
public class InboxId implements Serializable {

	private static final long serialVersionUID = 7681628654276795139L;

	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id", nullable = false, updatable = false)
	@org.hibernate.annotations.ForeignKey(name = "fk_inboxes_user_id")
	private User user;

	public InboxId() {

	}

	public InboxId(Long userId) {
		this(new User(userId));
	}

	public InboxId(User user) {
		this.user = user;
	}
}
